package com.metasoft.flex.dto
{
	import com.metasoft.flex.dto.XMLInfo;
	import com.metasoft.flex.dto.NetworkInfo;
	import com.metasoft.flex.dto.NaturalEnvironmentInfo;
	import com.metasoft.flex.dto.TerminalInfo;
	
	public class UsageEnvironment
	implements XMLInfo {

		public var networkInfo:NetworkInfo = new NetworkInfo();
		public var naturalEnviromentInfo:NaturalEnvironmentInfo = new NaturalEnvironmentInfo();
		public var terminalInfo:TerminalInfo = new TerminalInfo();
		
		public function set NetworkInfo(networkInfo:NetworkInfo):void {
			this.networkInfo = new NetworkInfo();
			this.networkInfo = networkInfo;
		}
		
		public function set TerminalInfo(terminalInfo:TerminalInfo):void {
			this.terminalInfo = new TerminalInfo();
			this.terminalInfo = terminalInfo;
		}
		
		public function set NaturalEnvironmentInfo(naturalEnviromentInfo:NaturalEnvironmentInfo):void {
			this.naturalEnviromentInfo = new NaturalEnvironmentInfo();
			this.naturalEnviromentInfo = naturalEnviromentInfo;
		}
		
		/**
		 * Converts this object to XML String.
		 */
		public function toXMLString():String {
			var usageInfo:String = new String();
			
			if (networkInfo != null) {
				usageInfo.concat(networkInfo.toXMLString());
			}
			
			if (naturalEnviromentInfo != null) {
				usageInfo.concat(naturalEnviromentInfo.toXMLString());
			}
			
			if (terminalInfo != null) {
				usageInfo.concat(terminalInfo.toXMLString());
			}
			
			return usageInfo;
		}		
	}
}